#ifndef _THREADPOLL_H
#define _THREADPOLL_H
#include<functional>
#include<vector>
#include<thread>
#include"Taskqueue.hh"

using std::function;
using std::vector;

using funcp=function<void()>;
class ThreadPool
{
public:
    ThreadPool(int threadnum,int capa);
    ~ThreadPool();
    void addTask(funcp& rhs);
public:
    void entry();
    void exit();
private:
    funcp getTask();
    void doTask();


private:
    int _threadnum;
    bool _isexit;
    int _quesize;
    TaskQueue _que;
    vector<std::thread> _thread;
};
#endif
